#ifndef COM_H
#define COM_H

static char * COMPORTS[] = {"COM1", "COM2", "COM3", "COM4", "COM5", "COM6"};
bool com_exist[6];
int avail_ports=0, * com_ports;

void list_com_interfaces()
{
 FILE * test;
 int port = 0, x = 0;
 
 printf("Building list of available com ports\n-------------------------------------\n");
 while(port<6)
 {
  com_exist[port]=false;
  test = fopen(COMPORTS[port], "rw");
  if(test != NULL){printf("%s  ", COMPORTS[port]); com_exist[port]=true; avail_ports++; fclose(test);}
  port++;             
 }
 printf("\n-------------------------------------\n");
 if(avail_ports < 2){printf("WARNING: not enough com ports for full functionality.  Not all features will be available\n");}
 printf("\n");
 com_ports = new int[avail_ports];
 port = 0;
 while(port<6)
 {
  if(com_exist[port]){com_ports[x]=port; x++;}
  port++;                       
 }
}

#endif
